package org.hz.util;


import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;

public class FreeChartUtil
{

	public static CategoryDataset createDataset()
	  {
	    DefaultCategoryDataset localDefaultCategoryDataset = new DefaultCategoryDataset();
	    localDefaultCategoryDataset.addValue(10.0D, "Series 1", "Category 1");
	    localDefaultCategoryDataset.addValue(4.0D, "Series 1", "Category 2");
	    localDefaultCategoryDataset.addValue(15.0D, "Series 1", "Category 3");
	    localDefaultCategoryDataset.addValue(14.0D, "Series 1", "Category 4");
	    localDefaultCategoryDataset.addValue(-5.0D, "Series 2", "Category 1");
	    localDefaultCategoryDataset.addValue(-7.0D, "Series 2", "Category 2");
	    localDefaultCategoryDataset.addValue(14.0D, "Series 2", "Category 3");
	    localDefaultCategoryDataset.addValue(-3.0D, "Series 2", "Category 4");
	    localDefaultCategoryDataset.addValue(6.0D, "Series 3", "Category 1");
	    localDefaultCategoryDataset.addValue(17.0D, "Series 3", "Category 2");
	    localDefaultCategoryDataset.addValue(-12.0D, "Series 3", "Category 3");
	    localDefaultCategoryDataset.addValue(7.0D, "Series 3", "Category 4");
	    localDefaultCategoryDataset.addValue(7.0D, "Series 4", "Category 1");
	    localDefaultCategoryDataset.addValue(15.0D, "Series 4", "Category 2");
	    localDefaultCategoryDataset.addValue(11.0D, "Series 4", "Category 3");
	    localDefaultCategoryDataset.addValue(0D, "Series 4", "Category 4");
	    localDefaultCategoryDataset.addValue(-8.0D, "Series 5", "Category 1");
	    localDefaultCategoryDataset.addValue(-6.0D, "Series 5", "Category 2");
	    localDefaultCategoryDataset.addValue(10.0D, "Series 5", "Category 3");
	    localDefaultCategoryDataset.addValue(-9.0D, "Series 5", "Category 4");
	    localDefaultCategoryDataset.addValue(9.0D, "Series 6", "Category 1");
	    localDefaultCategoryDataset.addValue(8.0D, "Series 6", "Category 2");
	    localDefaultCategoryDataset.addValue(0D, "Series 6", "Category 3");
	    localDefaultCategoryDataset.addValue(6.0D, "Series 6", "Category 4");
	    localDefaultCategoryDataset.addValue(-10.0D, "Series 7", "Category 1");
	    localDefaultCategoryDataset.addValue(9.0D, "Series 7", "Category 2");
	    localDefaultCategoryDataset.addValue(7.0D, "Series 7", "Category 3");
	    localDefaultCategoryDataset.addValue(7.0D, "Series 7", "Category 4");
	    localDefaultCategoryDataset.addValue(11.0D, "Series 8", "Category 1");
	    localDefaultCategoryDataset.addValue(13.0D, "Series 8", "Category 2");
	    localDefaultCategoryDataset.addValue(9.0D, "Series 8", "Category 3");
	    localDefaultCategoryDataset.addValue(9.0D, "Series 8", "Category 4");
	    localDefaultCategoryDataset.addValue(-3.0D, "Series 9", "Category 1");
	    localDefaultCategoryDataset.addValue(7.0D, "Series 9", "Category 2");
	    localDefaultCategoryDataset.addValue(11.0D, "Series 9", "Category 3");
	    localDefaultCategoryDataset.addValue(-10.0D, "Series 9", "Category 4");
	    return localDefaultCategoryDataset;
	  }

	  public static JFreeChart createChart(CategoryDataset paramCategoryDataset)
	  {
	    JFreeChart localJFreeChart = ChartFactory.createBarChart3D("3D Bar Chart Demo", "Category", "Value", paramCategoryDataset, PlotOrientation.VERTICAL, true, true, false);
	    CategoryPlot localCategoryPlot = (CategoryPlot)localJFreeChart.getPlot();
	    localCategoryPlot.setOutlineVisible(false);
	    localCategoryPlot.setDomainGridlinesVisible(true);
	    CategoryAxis localCategoryAxis = localCategoryPlot.getDomainAxis();
	    localCategoryAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.39269908169872414D));
	    localCategoryAxis.setCategoryMargin(0D);
	    BarRenderer3D localBarRenderer3D = (BarRenderer3D)localCategoryPlot.getRenderer();
	    localBarRenderer3D.setDrawBarOutline(false);
	    return localJFreeChart;
	  }
}
